package com.it.tydic.estate.module.controller.khgl;

import com.it.tydic.estate.common.annotation.ControllerDesc;
import com.it.tydic.estate.common.aop.Result;
import com.it.tydic.estate.common.constants.LogConstants;
import com.it.tydic.estate.module.model.Dto.CustomerProfileDto;
import com.it.tydic.estate.module.model.inner.Guanlichu;
import com.it.tydic.estate.module.model.inner.TbCustomerEvents;
import com.it.tydic.estate.module.model.inner.TbCustomerProfile;
import com.it.tydic.estate.module.service.CustomerProfileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @description:    客户档案管理接口
 * @author: liuhui
 * @createDate: 2020/3/2
 * @version: 1.0
 */
@RestController()
@RequestMapping("customerProfile")
@Api(tags = "客户档案管理")
public class CustomerProfileController {
    @Autowired
    private CustomerProfileService customerProfileService;  /*档案*/

    /**
     * 客户档案列表查询
     * @return
     */
    @PostMapping("/getListCustomer")
    @ApiOperation(value = "客户档案列表查询", notes = "客户档案列表查询")
    public Result getListCustomer(@RequestBody Map<String,Object> map){
        return customerProfileService.selectAllList(map);
    }

    /**
     * 客户档案详情
     * @return
     */
    @GetMapping("/getById/{uid}")
    @ApiOperation(value = "客户档案详情", notes = "客户档案详情")
    public Result getById(@RequestParam String uid){
        return customerProfileService.getById(uid);
    }
    /**
     * 客户档案修改
     * @return
     */
    @PostMapping("/addCustomer")
    @ControllerDesc(description = LogConstants.addOrUpdate_data)
    @ApiOperation(value = "客户档案修改(批量修改)", notes = "客户档案修改")
    public Result updateCustomer(@RequestBody TbCustomerProfile tbCustomerProfile){
        return customerProfileService.updataTbCustomerProfile(tbCustomerProfile);
    }
    /**
     * 房间树
     */
    @PostMapping("/getRoomTree")
    @ApiOperation(value = "房间树", notes = "房间树")
    public Result getRoomTree(@RequestParam String lyId){
        return customerProfileService.getRoomTree(lyId);
    }
    /**
     * 管理处
     */
    @PostMapping("/getGLC")
    @ApiOperation(value = "管理处", notes = "管理处")
    public  Result getGLC(@RequestParam String userCOde){
        return customerProfileService.getGLC(userCOde);
    }

}
